package prvydevw.entity;

import java.math.BigDecimal;
import java.util.Calendar;

/**
 *
 * @author ivo
 */
public class Payment
{
    private Long id;
    private BigDecimal amount;
    private Calendar date;
    private String description;
    private Long subjectID;
    private String number;
    
    /**
     * @return the id
     */
    public Long getId()
    {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id)
    {
        this.id = id;
    }

    /**
     * @return the amount
     */
    public BigDecimal getAmount()
    {
        return amount;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(BigDecimal amount)
    {
        if (amount != null) {
            this.amount = amount.setScale(2);
        }
        else {
            this.amount = amount;
        }
    }

    /**
     * @return the date
     */
    public Calendar getDate()
    {
        return date;
    }

    /**
     * @param date the date to set
     */
    public void setDate(Calendar date)
    {
        this.date = date;
    }

    /**
     * @return the description
     */
    public String getDescription()
    {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description)
    {
        this.description = description;
    }

    public Long getSubjectID() {
        return subjectID;
    }

    public void setSubjectID(Long subjectID) {
        this.subjectID = subjectID;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }
    
    @Override
    public String toString()
    {
        return "Payment{ id=" + id + "; amount=" + amount + "}";
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null) {
            return false;
        }
        
        if (getClass() != obj.getClass()) {
            return false;
        }
        
        final Payment other = (Payment) obj;
        
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        
        return true;
    }

    @Override
    public int hashCode()
    {
        int hash = 7;
        
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        
        return hash;
    }
}
